﻿
/*
   AlphabeticalListOfProductsReport view
*/

if exists(select * from dbo.sysobjects where 
   id = object_id(N'[dbo].[vw_AlphabeticalListOfProductsReport]') and
   OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[vw_AlphabeticalListOfProductsReport]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[vw_AlphabeticalListOfProductsReport]
AS
select SUBSTRING(p.Name,1,1) as SortGroupLetter, 
       p.Name as ProductName, 
       c.Name as CategoryName, 
       p.QuantityPerUnit, p.UnitsInStock
from Category c, Product p
where c.ID = p.CategoryId
GO

